#
# ribLibrary - 	a library of rib objects to be used for render preview
#
#    Copyright (C) 2008 - Roberto Hradec
#
# ---------------------------------------------------------------------------
#	 This file is part of SLUM.
#
#    SLUM is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    SLUM is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with SLUM.  If not, see <http://www.gnu.org/licenses/>.
# ---------------------------------------------------------------------------

rib = {}

rib['sphere'] = '''
    ReverseOrientation
    NuPatch
        7 4 # nu uorder
        [ 0 0 0 0 0.25 0.5 0.75 1 1 1 1 ] 0 1 # umin umax
        11 4 # nv vorder
        [ -0.25 -0.25 -0.125 0 0.125 0.25 0.375 0.5 0.625 0.75 0.875 1
          1.125 1.25 1.25 ] 0 1 # vmin vmax
        "vertex hpoint Pw" [ 9.596475e-17 -1 -2.5316185e-16 1 0.1999168 -1 0.1999168 1 0.61643 -0.7836116 0.61643 1
          0.86720247 4.4113033e-17 0.86720247 1 0.61643 0.7836116 0.61643 1 0.1999168 1 0.1999168 1
          1.2304236e-16 1 3.4154717e-17 1 9.596475e-17 -1 -2.5316185e-16 1 0.28272503 -1 -5.512922e-17 1
          0.87176364 -0.7836116 1.268959e-16 1 1.2264094 9.7213866e-17 3.2082685e-16 1 0.87176364 0.7836116 3.2920823e-16 1
          0.28272503 1 2.030501e-16 1 1.2304236e-16 1 3.4154717e-17 1 9.596475e-17 -1 -2.5316185e-16 1
          0.1999168 -1 -0.1999168 1 0.61643 -0.7836116 -0.61643 1 0.86720247 1.503147e-16 -0.86720247 1
          0.61643 0.7836116 -0.61643 1 0.1999168 1 -0.1999168 1 1.2304236e-16 1 3.4154717e-17 1
          9.596475e-17 -1 -2.5316185e-16 1 -1.8991932e-16 -1 -0.28272503 1 -4.2954374e-16 -0.7836116 -0.87176364 1
          -5.2948258e-16 1.7230979e-16 -1.2264094 1 -3.2319616e-16 0.7836116 -0.87176364 1 -5.4204673e-17 1 -0.28272503 1
          1.2304236e-16 1 3.4154717e-17 1 9.596475e-17 -1 -2.5316185e-16 1 -0.1999168 -1 -0.1999168 1
          -0.61643 -0.7836116 -0.61643 1 -0.86720247 1.503147e-16 -0.86720247 1 -0.61643 0.7836116 -0.61643 1
          -0.1999168 1 -0.1999168 1 1.2304236e-16 1 3.4154717e-17 1 9.596475e-17 -1 -2.5316185e-16 1
          -0.28272503 -1 9.820774e-17 1 -0.87176364 -0.7836116 2.8758069e-16 1 -1.2264094 9.7213866e-17 3.9726926e-16 1
          -0.87176364 0.7836116 2.7719785e-16 1 -0.28272503 1 8.4957776e-17 1 1.2304236e-16 1 3.4154717e-17 1
          9.596475e-17 -1 -2.5316185e-16 1 -0.1999168 -1 0.1999168 1 -0.61643 -0.7836116 0.61643 1
          -0.86720247 4.4113033e-17 0.86720247 1 -0.61643 0.7836116 0.61643 1 -0.1999168 1 0.1999168 1
          1.2304236e-16 1 3.4154717e-17 1 9.596475e-17 -1 -2.5316185e-16 1 8.074172e-17 -1 0.28272503 1
          9.290196e-17 -0.7836116 0.87176364 1 5.589015e-17 2.2117946e-17 1.2264094 1 -1.34456173e-17 0.7836116 0.87176364 1
          -5.4972927e-17 1 0.28272503 1 1.2304236e-16 1 3.4154717e-17 1 9.596475e-17 -1 -2.5316185e-16 1
          0.1999168 -1 0.1999168 1 0.61643 -0.7836116 0.61643 1 0.86720247 4.4113033e-17 0.86720247 1
          0.61643 0.7836116 0.61643 1 0.1999168 1 0.1999168 1 1.2304236e-16 1 3.4154717e-17 1
          9.596475e-17 -1 -2.5316185e-16 1 0.28272503 -1 -5.512922e-17 1 0.87176364 -0.7836116 1.268959e-16 1
          1.2264094 9.7213866e-17 3.2082685e-16 1 0.87176364 0.7836116 3.2920823e-16 1 0.28272503 1 2.030501e-16 1
          1.2304236e-16 1 3.4154717e-17 1 9.596475e-17 -1 -2.5316185e-16 1 0.1999168 -1 -0.1999168 1
          0.61643 -0.7836116 -0.61643 1 0.86720247 1.503147e-16 -0.86720247 1 0.61643 0.7836116 -0.61643 1
          0.1999168 1 -0.1999168 1 1.2304236e-16 1 3.4154717e-17 1 ]
'''

rib['teapot'] = '''
        Scale 0.25 0.25 0.25
        Rotate -15 1 0 0
        Rotate 170 0 1 0
        Rotate -70 1 0 0
        Scale 1.5 1.5 1.5
        Translate 0 -2 0
        #ReverseOrientation
        PatchMesh "bicubic" 13 "nonperiodic" 10 "nonperiodic" "P" [1.5 0 0 1.5 0.828427 0 0.828427 1.5 0 0 1.5 0 -0.828427 1.5 0 -1.5 0.828427 0 -1.5 0 0 -1.5 -0.828427 0 -0.828427 -1.5 0 0 -1.5 0 0.828427 -1.5 0 1.5 -0.828427 0 1.5 0 0 1.5 0 0.075 1.5 0.828427 0.075 0.828427 1.5 0.075 0 1.5 0.075 -0.828427 1.5 0.075 -1.5 0.828427 0.075 -1.5 0 0.075 -1.5 -0.828427 0.075 -0.828427 -1.5 0.075 0 -1.5 0.075 0.828427 -1.5 0.075 1.5 -0.828427 0.075 1.5 0 0.075 2 0 0.3 2 1.10457 0.3 1.10457 2 0.3 0 2 0.3 -1.10457 2 0.3 -2 1.10457 0.3 -2 0 0.3 -2 -1.10457 0.3 -1.10457 -2 0.3 0 -2 0.3 1.10457 -2 0.3 2 -1.10457 0.3 2 0 0.3 2 0 0.75 2 1.10457 0.75 1.10457 2 0.75 0 2 0.75 -1.10457 2 0.75 -2 1.10457 0.75 -2 0 0.75 -2 -1.10457 0.75 -1.10457 -2 0.75 0 -2 0.75 1.10457 -2 0.75 2 -1.10457 0.75 2 0 0.75 2 0 1.2 2 1.10457 1.2 1.10457 2 1.2 0 2 1.2 -1.10457 2 1.2 -2 1.10457 1.2 -2 0 1.2 -2 -1.10457 1.2 -1.10457 -2 1.2 0 -2 1.2 1.10457 -2 1.2 2 -1.10457 1.2 2 0 1.2 1.75 0 1.725 1.75 0.966498 1.725 0.966498
            1.75 1.725 0 1.75 1.725 -0.966498 1.75 1.725 -1.75 0.966498 1.725 -1.75 0 1.725 -1.75 -0.966498 1.725 -0.966498 -1.75 1.725 0 -1.75 1.725 0.966498 -1.75 1.725 1.75 -0.966498 1.725 1.75 0 1.725 1.5 0 2.25 1.5 0.828427 2.25 0.828427 1.5 2.25 0 1.5 2.25 -0.828427 1.5 2.25 -1.5 0.828427 2.25 -1.5 0 2.25 -1.5 -0.828427 2.25 -0.828427 -1.5 2.25 0 -1.5 2.25 0.828427 -1.5 2.25 1.5 -0.828427 2.25 1.5 0 2.25 1.4375 0 2.38125 1.4375 0.793909 2.38125 0.793909 1.4375 2.38125 0 1.4375 2.38125 -0.793909 1.4375 2.38125 -1.4375 0.793909 2.38125 -1.4375 0 2.38125 -1.4375 -0.793909 2.38125 -0.793909 -1.4375 2.38125 0 -1.4375 2.38125 0.793909 -1.4375 2.38125 1.4375 -0.793909 2.38125 1.4375 0 2.38125 1.3375 0 2.38125 1.3375 0.738681 2.38125 0.738681 1.3375 2.38125 0 1.3375 2.38125 -0.738681 1.3375 2.38125 -1.3375 0.738681 2.38125 -1.3375 0 2.38125 -1.3375 -0.738681 2.38125 -0.738681 -1.3375 2.38125 0 -1.3375 2.38125 0.738681 -1.3375 2.38125 1.3375 -0.738681 2.38125 1.3375 0 2.38125 1.4 0 2.25 1.4
            0.773198 2.25 0.773198 1.4 2.25 0 1.4 2.25 -0.773198 1.4 2.25 -1.4 0.773198 2.25 -1.4 0 2.25 -1.4 -0.773198 2.25 -0.773198 -1.4 2.25 0 -1.4 2.25 0.773198 -1.4 2.25 1.4 -0.773198 2.25 1.4 0 2.25 ]
        PatchMesh "bicubic" 13 "nonperiodic" 7 "nonperiodic" "P" [1.3 0 2.25 1.3 0.71797 2.25 0.71797 1.3 2.25 0 1.3 2.25 -0.71797 1.3 2.25 -1.3 0.71797 2.25 -1.3 0 2.25 -1.3 -0.71797 2.25 -0.71797 -1.3 2.25 0 -1.3 2.25 0.71797 -1.3 2.25 1.3 -0.71797 2.25 1.3 0 2.25 1.3 0 2.4 1.3 0.71797 2.4 0.71797 1.3 2.4 0 1.3 2.4 -0.71797 1.3 2.4 -1.3 0.71797 2.4 -1.3 0 2.4 -1.3 -0.71797 2.4 -0.71797 -1.3 2.4 0 -1.3 2.4 0.71797 -1.3 2.4 1.3 -0.71797 2.4 1.3 0 2.4 0.4 0 2.4 0.4 0.220914 2.4 0.220914 0.4 2.4 0 0.4 2.4 -0.220914 0.4 2.4 -0.4 0.220914 2.4 -0.4 0 2.4 -0.4 -0.220914 2.4 -0.220914 -0.4 2.4 0 -0.4 2.4 0.220914 -0.4 2.4 0.4 -0.220914 2.4 0.4 0 2.4 0.2 0 2.55 0.2 0.110457 2.55 0.110457 0.2 2.55 0 0.2 2.55 -0.110457 0.2 2.55 -0.2 0.110457 2.55 -0.2 0 2.55 -0.2 -0.110457 2.55 -0.110457 -0.2 2.55 0 -0.2 2.55 0.110457 -0.2 2.55 0.2 -0.110457 2.55 0.2 0 2.55 0 0 2.7 0 0 2.7 0 0 2.7 0 0 2.7 0 0 2.7 0 0 2.7 0 0 2.7 0 0 2.7 0 0 2.7 0 0 2.7 0 0 2.7 0 0 2.7 0 0 2.7 0.8 0 3 0.8 0.441828
            3 0.441828 0.8 3 0 0.8 3 -0.441828 0.8 3 -0.8 0.441828 3 -0.8 0 3 -0.8 -0.441828 3 -0.441828 -0.8 3 0 -0.8 3 0.441828 -0.8 3 0.8 -0.441828 3 0.8 0 3 0 0 3 0 0 3 0 0 3 0 0 3 0 0 3 0 0 3 0 0 3 0 0 3 0 0 3 0 0 3 0 0 3 0 0 3 0 0 3 ]
        PatchMesh "bicubic" 4 "nonperiodic" 7 "nonperiodic" "P" [-2 0 0.75 -2 0.3 0.75 -1.9 0.3 0.45 -1.9 0 0.45 -2.5 0 0.975 -2.5 0.3 0.975 -2.65 0.3 0.7875 -2.65 0 0.7875 -2.7 0 1.425 -2.7 0.3 1.425 -3 0.3 1.2 -3 0 1.2 -2.7 0 1.65 -2.7 0.3 1.65 -3 0.3 1.65 -3 0 1.65 -2.7 0 1.875 -2.7 0.3 1.875 -3 0.3 2.1 -3 0 2.1 -2.3 0 1.875 -2.3 0.3 1.875 -2.5 0.3 2.1 -2.5 0 2.1 -1.6 0 1.875 -1.6 0.3 1.875 -1.5 0.3 2.1 -1.5 0 2.1 ]
        PatchMesh "bicubic" 4 "nonperiodic" 7 "nonperiodic" "P" [2.8 0 2.25 2.8 0.15 2.25 3.2 0.15 2.25 3.2 0 2.25 2.9 0 2.325 2.9 0.25 2.325 3.45 0.15 2.3625 3.45 0 2.3625 2.8 0 2.325 2.8 0.25 2.325 3.525 0.25 2.34375 3.525 0 2.34375 2.7 0 2.25 2.7 0.25 2.25 3.3 0.25 2.25 3.3 0 2.25 2.3 0 1.95 2.3 0.25 1.95 2.4 0.25 1.875 2.4 0 1.875 2.6 0 1.275 2.6 0.66 1.275 3.1 0.66 0.675 3.1 0 0.675 1.7 0 1.275 1.7 0.66 1.275 1.7 0.66 0.45 1.7 0 0.45 ]
        PatchMesh "bicubic" 4 "nonperiodic" 7 "nonperiodic" "P" [-1.9 0 0.45 -1.9 -0.3 0.45 -2 -0.3 0.75 -2 0 0.75 -2.65 0 0.7875 -2.65 -0.3 0.7875 -2.5 -0.3 0.975 -2.5 0 0.975 -3 0 1.2 -3 -0.3 1.2 -2.7 -0.3 1.425 -2.7 0 1.425 -3 0 1.65 -3 -0.3 1.65 -2.7 -0.3 1.65 -2.7 0 1.65 -3 0 2.1 -3 -0.3 2.1 -2.7 -0.3 1.875 -2.7 0 1.875 -2.5 0 2.1 -2.5 -0.3 2.1 -2.3 -0.3 1.875 -2.3 0 1.875 -1.5 0 2.1 -1.5 -0.3 2.1 -1.6 -0.3 1.875 -1.6 0 1.875 ]
        PatchMesh "bicubic" 4 "nonperiodic" 7 "nonperiodic" "P" [3.2 0 2.25 3.2 -0.15 2.25 2.8 -0.15 2.25 2.8 0 2.25 3.45 0 2.3625 3.45 -0.15 2.3625 2.9 -0.25 2.325 2.9 0 2.325 3.525 0 2.34375 3.525 -0.25 2.34375 2.8 -0.25 2.325 2.8 0 2.325 3.3 0 2.25 3.3 -0.25 2.25 2.7 -0.25 2.25 2.7 0 2.25 2.4 0 1.875 2.4 -0.25 1.875 2.3 -0.25 1.95 2.3 0 1.95 3.1 0 0.675 3.1 -0.66 0.675 2.6 -0.66 1.275 2.6 0 1.275 1.7 0 0.45 1.7 -0.66 0.45 1.7 -0.66 1.275 1.7 0 1.275 ]
'''

rib['ground'] = '''
  #Transform [ 42.55857 0 0 0 0 42.55857 0 0 0 0 42.55857 0 0 0 0 1 ]
  PointsGeneralPolygons
    [ 1 ]
    [ 4 ]
    [ 2 3 1 0 ]
    "vertex point P" [ -0.5 -8.966352e-17 0.5 0.5 -8.966352e-17 0.5 -0.5 8.966352e-17 -0.5 0.5 8.966352e-17 -0.5 ]
    "facevarying normal N" [ 0 1 1.7932704e-16 0 1 1.7932704e-16 0 1 1.7932704e-16 0 1 1.7932704e-16 ]
    "facevarying float[2] st" [ 0 0 1 0 1 1 0 1 ]
    "facevarying vector stangent" [ 1 0 0 1 0 0 1 0 0 1 0 0 ]
'''
